﻿<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<LeanBoard.Models.ItemsCollection>" %>
<%@ Import Namespace="LeanBoard.HtmlBuilders" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Index</title>
    <link href="../../Content/Site.css" rel="stylesheet" type="text/css" />
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script> 
	<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.min.js" type="text/javascript"></script> 
    <script src="../../Scripts/jquery.keypad.min.js" type="text/javascript"></script>
    <link href="../../Client/css/jquery.keypad.alt.css" rel="stylesheet" type="text/css" />
    <script src="../../Client/jquery.tools.min.js" type="text/javascript"></script>

    <script type="text/javascript">
        $(document).ready(function () {
            $("#scheduled, #analysis, #analysisReadyForReview, #analysisReview, #readyForDevelopment,  #development, #readyForCodeReview, #codeReview, #readyForApproval, #testing,  #done").sortable({ connectWith: '.list', placeholder: 'placeholder cr', opacity: '0.5',
                stop: function (event, ui) {
                    $.post(
                    "/leanboard/Move", getValue(ui.item), function (data) { alert(data); location.reload(); }
                    );
                }
            }).disableSelection();

            $("div.scrollable").scrollable({ size: 1 }).circular().mousewheel(400);
            $("#main").overlay({ effect: 'apple', target: '#standup' });

            $("li").overlay({ effect: 'apple' });
            //keyboard plugin http://keith-wood.name/keypad.html
            $("#search").keypad({ keypadClass: 'darkKeypad', keypadOnly: false, layout: $.keypad.qwertyLayout, prompt: '' });

            $("#search").change(function () { filterChangeRequests(); });
            $("#search").keyup(function () { filterChangeRequests(); });

            function filterChangeRequests() {
                var searchTerm = $("#search").val().toLowerCase();
                $(".crTitle").each(function () {
                    if (this.innerHTML.toLowerCase().indexOf(searchTerm) == -1) {
                        $(this).parent().fadeOut(500);
                    }
                    else
                    { $(this).parent().fadeIn(500); }
                });
            }
        });

        function getValue(item) {		
            return { Id: $(item).find("h1").html(), DevResponsible: $(item).find(".crResponsible").html(), QaResponsible: $(item).find(".crQAResponsible").html(), Status: $(item).parent().attr("id"), Unid: $(item).find(".unid").html() };
        }
	</script>

</head>
<body>
    <div class="main">
        <div class="searchAre" style="float:right;">
          <% using (Html.BeginForm()) { %>
               <label for="search">Search</label>
               <%= Html.TextBox("search")%>
          <% } %>
        </div>
        <div style="text-align:center;"><h1 id="main">Operations Development WIP (10)</h1></div>
             <div class="columnGroup groupScheduled">
            <h1  class="columnHeader">Scheduled</h1>
            <div class="column">
                <h2 class="columnHeader">Queue<br /> ( <%= Model.Scheduled.Count%> )</h2>
                <ul id="scheduled" class="list">
                    <%= new ItemHtmlBuilder().BuildHtml(Model.Scheduled) %>
                </ul>
            </div>
            </div>

           <div class="columnGroup groupAnalysis">
           <h1  class="columnHeader leftBorder">Analysis</h1>
            <div class="column analysis leftBorder">
                <h2 class="columnHeader">In Progress <br />( <%= Model.Analysis.Count%> )</h2>
                <ul id="analysis" class="list">
                    <%= new ItemHtmlBuilder().BuildHtml(Model.Analysis) %>
                </ul>
            </div>

            <div class="column analysis leftBorder">
                <h2 class="columnHeader">Ready for <br /> ( <%= Model.AnalysisReadyForReview.Count%> )</h2>
                <ul id="analysisReadyForReview" class="list">
                    <%= new ItemHtmlBuilder().BuildHtml(Model.AnalysisReadyForReview) %>
                </ul>
            </div>

            <div class="column analysis leftBorder">
                <h2 class="columnHeader">Review <br />( <%= Model.AnalysisReview.Count%> )</h2>
                <ul id="analysisReview" class="list">
                    <%= new ItemHtmlBuilder().BuildHtml(Model.AnalysisReview) %>
                </ul>
            </div> 
            
            </div>                  

            <div class="columnGroup groupDevelopment">
            <h1  class="columnHeader leftBorder">Development</h1>
            <div class="column development leftBorder">
                <h2 class="columnHeader">Ready for <br /> ( <%= Model.ReadyForDevelopment.Count%> )</h2>
                <ul id="readyForDevelopment" class="list">
                    <%= new ItemHtmlBuilder().BuildHtml(Model.ReadyForDevelopment) %>
                </ul>
            </div>
            
            <div class="column development leftBorder">
                <h2 class="columnHeader">Development <br /> ( <%= Model.Development.Count%> )</h2>
                <ul id="development" class="list">
                    <%= new ItemHtmlBuilder().BuildHtml(Model.Development) %>
                </ul>
            </div>

            <div class="column development leftBorder">
                <h2 class="columnHeader">Ready for <br /> ( <%= Model.ReadyForCodeReview.Count%> )</h2>
                <ul id="readyForCodeReview" class="list">
                    <%= new ItemHtmlBuilder().BuildHtml(Model.ReadyForCodeReview) %>
                </ul>
            </div>

            <div class="column development leftBorder">
                <h2 class="columnHeader">Code Review <br /> ( <%= Model.CodeReview.Count%> )</h2>
                <ul id="codeReview" class="list">
                    <%= new ItemHtmlBuilder().BuildHtml(Model.CodeReview) %>
                </ul>
            </div>
            </div>

            <div class="columnGroup groupTesting">
            <h1 class="columnHeader leftBorder">Testing</h1>
            <div class="column testing leftBorder">
                <h2 class="columnHeader">Ready for <br /> ( <%= Model.ReadyForApporval.Count%> )</h2>
                <ul id="readyForApproval" class="list">
                    <%= new ItemHtmlBuilder().BuildHtml(Model.ReadyForApporval) %>
                </ul>
            </div>

            <div class="column testing leftBorder">
                <h2 class="columnHeader">Testing <br /> ( <%= Model.Testing.Count%> )</h2>
                <ul id="testing" class="list">
                    <%= new ItemHtmlBuilder().BuildHtml(Model.Testing) %>
                </ul>
            </div>
            
            <div class="column testing leftBorder">
                <h2 class="columnHeader">Done <br /> ( <%= Model.Done.Count%> )</h2>
                <ul id="done" class="list">
                <%= new ItemHtmlBuilder().BuildHtml(Model.Done) %>
                </ul>
            </div>  
            </div>
                                
    </div>

    <div class="apple_overlay black" id="standup">
                <div class="scrollable">
                    <div class="items">
                        <%=
        
                            new ItemHtmlBuilder().BuildStandupItems(Model) %>
                    </div>
                </div>
            </div>  
</body>
</html>
